package com.xiaoyu.shenyou.shenyouv1.controller;

import com.xiaoyu.shenyou.shenyouv1.common.result.Result;
import com.xiaoyu.shenyou.shenyouv1.entity.NoticeEntity;
import com.xiaoyu.shenyou.shenyouv1.services.NoticesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/api/v1/notices")
public class NoticesController {

    @Autowired
    private NoticesService noticesService;

    @GetMapping("/{type}")
    public Result notice(@PathVariable int type) {
        NoticeEntity notice = noticesService.queryNotices(type);
        Result<NoticeEntity> success = Result.success(notice);
        return success;
    }
}
